package org.swidgets.base.sinputbox;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.TextBoxBase;

public class SIntegerInputBox extends SRegexInputBox {
	
	private static final boolean isDesignTime() {
		return false;
	}
	
	public SIntegerInputBox() {
		super(RegExpConstants.INTEGER,RegExpConstants.INTEGER_ERROR_MESSAGE );
		this.setTextAlignment(TextBoxBase.ALIGN_RIGHT);
		if (isDesignTime()) {
			this.setText("IntegerInputBox");		
		}
	}

	public SIntegerInputBox(String label) {
		super(label,RegExpConstants.INTEGER,RegExpConstants.INTEGER_ERROR_MESSAGE );
		this.setTextAlignment(TextBoxBase.ALIGN_RIGHT);
	}
	
	public SIntegerInputBox(String label, AsyncDataValidator asyncDataValidator) {
		super(label,RegExpConstants.INTEGER,RegExpConstants.INTEGER_ERROR_MESSAGE );
		this.setTextAlignment(TextBoxBase.ALIGN_RIGHT);
	}
	
		
	protected void onFailure() {
		GWT.log("NumericTextBox.onFailure --> Formato Errato", null);
		errorOn(this.message);
	}

}
